<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link rel="stylesheet/less" href="./less/reset.less"/>
    <link rel="stylesheet/less" href="./less/myWallet.less"/>
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.4/weui.min.css">
    <script src="https://cdn.bootcdn.net/ajax/libs/less.js/4.1.1/less.min.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/qs/6.9.6/qs.js"></script>
    <script src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <title></title>
</head>
<body>
    <div id="app">
        <div class="main">
            <div class="login-top">
                <header class="title">
                    <div class="spell">我的钱包</div>
                    <a href="./mine.html">
                        <img src="./img/arrow_back.png">
                    </a>
                </header>
                <div>
                    <ul>
                        <li>
                            <ul>
                                <li>余额</li>
                                <li>{{balance}}</li>
                            </ul>
                        </li>
                        <li>
                            <ul>
                                <li>积分</li>
                                <li>{{integral}}</li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
            <ul class="way">
                <li>
                    <a href="./top_up.html">充值</a>
                </li>
                <li @click="totas">提现</li>
            </ul>
            <div id="dialogs" v-if="status">
                <div class="js_dialog" id="iosDialog1">
                    <div class="weui-mask"></div>
                    <div class="weui-dialog">
                        <div class="weui-dialog__hd"><strong class="weui-dialog__title">去APP提现</strong></div>
                        <div class="weui-dialog__bd">亲爱的用户您好，如需提现请下载柒星社区APP进行提现</div>
                        <div class="weui-dialog__ft">
                            <a href="javascript:" class="weui-dialog__btn weui-dialog__btn_default" @click="totas">取消</a>
                            <a href="http://fir.fhzhny.com/9zng" class="weui-dialog__btn weui-dialog__btn_primary" @click="totas">去下载</a>
                        </div>
                    </div>
                </div>
            </div>    
        </div>
    </div>
</body>
</html>
<script type="module">
    import { myIntegral, myBalance } from './js/request/api.js';
    import { shareLink } from './js/public.js';
    Vue.prototype.public = {shareLink};
     let app = new Vue({
        el: '#app',
        data: {
            api: 'http://mall.fhzhny.com/api',
            status: false,
            balance: '',
            integral: '',
            userId: ''

        },
        mounted(){
            let that = this;
                that.wallet();
                that.public.shareLink();
        },
        methods:{

            totas(){
                let status = this.status;
                this.status = !status;
            },

            wallet(){

                let that = this;
                let userData = JSON.parse(localStorage.getItem("userData"));
                    that.userId = userData.userId;

                    myIntegral({
                        userId: userData.userId
                    }) .then(res=>{
                        that.integral = res.data.integral;
                    })
                    .catch(error=>{
                        console.log(error);
                    });

                    myBalance({
                        userId: userData.userId
                    }).then((res)=>{
                        that.balance = res.data.availablePredeposit;
                    }).catch((error)=>{
                        console.log(error);
                    })
            },
        },
    })
</script>